#include "mainwindow.h"
#include <QApplication>
#include <QSurfaceFormat>
#include "Program.h"

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    QApplication::setWindowIcon(QIcon(":/resource/Avatar.ico"));
    QCoreApplication::setOrganizationName("luoyexunxue");
    QCoreApplication::setApplicationName("AvatarEditor");
    QSurfaceFormat format;
    format.setDepthBufferSize(24);
    QSurfaceFormat::setDefaultFormat(format);

    MainWindow w;
    Program::MainWin = &w;
    w.show();
    a.processEvents();
    // 获取打开项目参数
    QStringList arguments = QCoreApplication::arguments();
    for (int i = 1; i < arguments.size(); i++) {
        if (arguments[i].toUpper().endsWith(".AVATARPROJ")) {
            w.OpenWorkspace(arguments[i]);
            break;
        }
    }
    return a.exec();
}
